package com.cdhk.service.impl;

import cn.hutool.core.util.RandomUtil;
import com.cdhk.constant.ErrorCodeEnum;
import lombok.extern.slf4j.Slf4j;
import com.cdhk.entity.TestMappingDO;
import com.cdhk.service.TestMappingService;
import com.cdhk.mapper.CommonMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Description xxx
 *
 * @auther: xxx
 * @date: xxx
 */
@Slf4j
@Service
public class TestMappingServiceImpl implements TestMappingService {

    @Resource
    private CommonMapper testMappingMapper;

    @Override
    public TestMappingDO testFunc() {
        if (RandomUtil.randomBoolean()) {
            throw ErrorCodeEnum.TEST_ERROR_CODE_ENUM.getException();
        }

        return testMappingMapper.selectOne(new TestMappingDO());
    }
}